﻿<UserControl x:Uid="UserControl_1" x:Class="Up2dateConsole.Dialogs.Settings.InstallationPolicyTab"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Up2dateConsole.Dialogs.Settings"
             xmlns:helpers="clr-namespace:Up2dateConsole.Helpers"
             xmlns:s="clr-namespace:Up2dateConsole.ServiceReference"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="500"
             d:DataContext="{d:DesignInstance local:InstallationPolicyTabViewModel}">
    <UserControl.Resources>
        <ResourceDictionary x:Uid="ResourceDictionary_1" >
            <Style x:Uid="Style_1" TargetType="{x:Type Button}">
                <Setter x:Uid="Setter_1" Property="Padding" Value="5,4"/>
                <Setter x:Uid="Setter_2" Property="Margin" Value="5"/>
                <Setter x:Uid="Setter_3" Property="MinWidth" Value="70"/>
            </Style>

            <BooleanToVisibilityConverter x:Uid="BooleanToVisibilityConverter_1" x:Key="BooleanToVisibilityConverter" />
            <helpers:EnumToBooleanConverter x:Uid="helpers:EnumToBooleanConverter_1" x:Key="EnumToBooleanConverter" />
            <helpers:EnumToVisibilityConverter x:Uid="helpers:EnumToVisibilityConverter_1" x:Key="EnumToVisibilityConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    
    <StackPanel x:Uid="StackPanel_6">
        <CheckBox x:Uid="CheckBox_1" Margin="0,15,0,5" Content="Install package only after confirmation"
                  IsChecked="{Binding ConfirmBeforeInstallation, UpdateSourceTrigger=PropertyChanged}"/>
        <CheckBox x:Uid="CheckBox_2" Margin="0,10,0,5" Content="Verify package signature before installation"
                  IsChecked="{Binding CheckSignatureStatus, UpdateSourceTrigger=PropertyChanged}"/>
        <StackPanel x:Uid="StackPanel_3" Margin="20,0,0,0"
                    Visibility="{Binding CheckSignatureStatus, Converter={StaticResource BooleanToVisibilityConverter}}">
            <RadioButton x:Uid="RadioButton_1" Margin="0,5,0,5" Content="Accept packages signed by any certificate"
                         IsChecked="{Binding SignatureVerificationLevel, ConverterParameter={x:Static s:SignatureVerificationLevel.SignedByAnyCertificate}, Converter={StaticResource EnumToBooleanConverter}}"/>
            <RadioButton x:Uid="RadioButton_2" Margin="0,5,0,5" Content="Accept packages signed by valid trusted certificate"
                         IsChecked="{Binding SignatureVerificationLevel, ConverterParameter={x:Static s:SignatureVerificationLevel.SignedByTrustedCertificate}, Converter={StaticResource EnumToBooleanConverter}}"/>
            <StackPanel x:Uid="StackPanel_4">
                <Grid x:Uid="Grid_2">
                    <RadioButton x:Uid="RadioButton_3" Margin="0,5,0,5" VerticalAlignment="Center" Content="Accept only packages signed by a whitelisted certificate"
                                 IsChecked="{Binding SignatureVerificationLevel, ConverterParameter={x:Static s:SignatureVerificationLevel.SignedByWhitelistedCertificate}, Converter={StaticResource EnumToBooleanConverter}}"/>
                    <Button x:Uid="Button_3" HorizontalAlignment="Right" Margin="0,2" VerticalAlignment="Center"
                            Content="Add Certificate" ToolTip="Add certificate to whitelist"
                            Command="{Binding AddCertificateCommand}"/>
                </Grid>
                <TextBlock x:Uid="TextBlock_4" Margin="20,0,0,0"
                           Visibility="{Binding SignatureVerificationLevel, ConverterParameter={x:Static s:SignatureVerificationLevel.SignedByWhitelistedCertificate}, Converter={StaticResource EnumToVisibilityConverter}}">
                    <Run x:Uid="Run_1" Text="To view and modify the white list you can use "/>
                    <Hyperlink x:Uid="Hyperlink_1" Command="{Binding LaunchCertMgrShapinCommand}">Certificates Snap-in</Hyperlink>
                </TextBlock>
            </StackPanel>
        </StackPanel>
    </StackPanel>
</UserControl>
